Home:ALL Converter>What changes\setups I need to make to run java in docker over WSL(windows-subsystem-for-linux)?

What changes\setups I need to make to run java in docker over WSL(windows-subsystem-for-linux)?

Ask Time:2019-06-14T19:43:25         Author:chdanish

Json Formatter

I'm running the docker command in windows command line successfully but when I run the same command in windows-subsystem-for-linux it shows class not found exception.

windows: docker run -it --cpus 4 -v ${PWD}:/app --workdir /app adoptopenjdk/openjdk11 java -cp C:\path\to\class Helloworld.java

WSL: docker run -it --cpus 4 -v ${PWD}:/app --workdir /app adoptopenjdk/openjdk11 java -cp /path/to/class Helloworld.java

Expected output:

Hello world!!

Error:

Could not find or load main class Helloworld.java

Caused by: java.lang.ClassNotFoundException: Helloworld.java

Author:chdanish,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56597480/what-changes-setups-i-need-to-make-to-run-java-in-docker-over-wslwindows-subsys
yy